//
//  LSRHotCommentView.m
//  BaiSiProject
//
//  Created by lshenrong on 16/7/14.
//  Copyright © 2016年 lshenrong. All rights reserved.
//

#import "LSRHotCommentView.h"
#import "LSRCommentItem.h"
#import "LSRThemeItem.h"
#import "LSRUserItem.h"
@class LSRHotCommentView;
@interface LSRHotCommentView ()
@property (weak, nonatomic) IBOutlet UIView *voiceView;
@property (weak, nonatomic) IBOutlet UILabel *totalContentView;
@property (weak, nonatomic) IBOutlet UIButton *voiceButton;
@property (weak, nonatomic) IBOutlet UILabel *nameView;

@end

@implementation LSRHotCommentView
// 以后只要发现一个view从xib加载后,发现一些莫名其妙问题,尝试取消自动拉伸属性
- (void)awakeFromNib
{
    // iOS6属性,自动拉伸
    // 每一个View默认都会有拉伸属性,
    // 取消拉伸属性
    self.autoresizingMask = UIViewAutoresizingNone;
}


+(instancetype)hotCommentView
{

    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self)    owner:nil options:nil] lastObject];

}

-(void)setItem:(LSRThemeItem *)item
{
       _item=item;
    if (item.commentItem.content.length) {
        //显示文本
        self.voiceView.hidden=YES;
        self.totalContentView.hidden=NO;
        _totalContentView.text=item.commentItem.totalContent;
        
    }
    else
    {
        //显示音频按钮
        self.voiceView.hidden=NO;
        self.totalContentView.hidden=YES;
        self.nameView.text=[NSString stringWithFormat:@"%@:",item.commentItem.userItem.username];
      
        
        [_voiceButton setTitle:item.commentItem.voicetime forState:UIControlStateNormal];

    
    }
   



}



@end
